/*
 * @Descripttion:
 * @version:
 * @Author: hujianli
 * @Date: 2022-07-03 10:15:10
 * @LastEditors: hujianli
 * @LastEditTime: 2022-07-03 10:26:38
 */
package main

import (
	"log"
	"os"
	"text/template"
)

type Invoice struct {
	Name    string
	Paid    bool
	Changes []float64
	Total   float64
}

func check(err error) {
	if err != nil {
		log.Fatal(err)
	}
}

func main() {
	html, err := template.ParseFiles("bill.html")
	check(err)
	bill := Invoice{Name: "hujianli", Paid: true, Changes: []float64{1.00, 12.0, 2.00}, Total: 15.0}
	err = html.Execute(os.Stdout, bill)
	check(err)
}
